﻿using System;
using System.Collections.Generic;
using System.Xml;
using System.Xml.Linq;

namespace XmlSockets
{
    /// <summary>
    /// 
    /// </summary>
    /// <param name="args"></param>
    public delegate void ClientXmlSocketCloseHandler( ClientXmlSocketCloseEventArgs args);

    /// <summary>
    /// 
    /// </summary>
    /// <param name="args"></param>
    public delegate void ClientXmlSocketReceiveHandler( ClientXmlSocketReceiveEventArgs args);



    
    /// <summary>
    /// 
    /// </summary>
    public abstract class ClientXmlSocketEventArgsBase : EventArgs 
    {
        /// <summary>
        /// 
        /// </summary>
        public ClientXmlSocket Client { get; private set; }

        internal ClientXmlSocketEventArgsBase(ClientXmlSocket client) { Client = client; }
    }

    


    /// <summary>
    /// 
    /// </summary>
    public sealed class ClientXmlSocketCloseEventArgs : ClientXmlSocketEventArgsBase
    {
        /// <summary>
        /// 
        /// </summary>
        public string Reason { get; internal set; }

        /// <summary>
        /// 
        /// </summary>
        public Exception Exception { get; internal set; }
        internal ClientXmlSocketCloseEventArgs(ClientXmlSocket client) : base(client) { }
    }

    /// <summary>
    /// 
    /// </summary>
    public sealed class ClientXmlSocketExceptionEventArgs:ClientXmlSocketEventArgsBase
    {
        /// <summary>
        /// 
        /// </summary>
        public Exception Exception { get; internal set; }
        internal ClientXmlSocketExceptionEventArgs(ClientXmlSocket client) : base(client) { }
    }

    /// <summary>
    /// 
    /// </summary>
    public sealed class ClientXmlSocketReceiveEventArgs : ClientXmlSocketEventArgsBase
    {
        /// <summary>
        /// 
        /// </summary>
        public IEnumerable<XElement> Messages { get; internal set; }
        internal ClientXmlSocketReceiveEventArgs(ClientXmlSocket client) : base(client) { }
    }
}
